<template>
  <div id="ImportCountry" ref="ImportCountryRef">
    <div class="left">
      <div class="item" v-for="(item, index) in arrLeft" :key="index">
        <div>
          <span :class="{ 'num': true, 'numBg': index + 1 < 4 }">{{ index + 1 }}</span>
          <span class="name text-ellipsis">{{ item?.name }}</span>
        </div>
        <div class="item_right">
          <span class="count text-ellipsis">{{ item?.count }}</span>
          <div>
            <img class="trendImg" v-show="item.trend == 'down'" src="@/assets/image/down.png" />
            <img class="trendImg" v-show="item.trend == 'up'" src="@/assets/image/up.png" />
          </div>
        </div>
      </div>
    </div>
    <div class="right">
      <div class="item" v-for="(item, index) in arrRight" :key="index">
        <div>
          <span class="num">{{ index + 6 }}</span>
          <span class="name text-ellipsis">{{ item?.name }}</span>
        </div>
        <div class="item_right">
          <span class="count text-ellipsis">{{ item?.count }}</span>
          <div>
            <img class="trendImg" v-show="item.trend == 'down'" src="@/assets/image/down.png" />
            <img class="trendImg" v-show="item.trend == 'up'" src="@/assets/image/up.png" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
  
<script lang="ts" setup>
import { Ref, ref } from "vue";
let arr: Ref<Array<object>> = ref([])
arr.value = [{
  name: '秘鲁1',
  count: '5.5',
  trend: 'down',
},
{
  name: '秘鲁',
  count: '5.5',
  trend: 'up',
},
{
  name: '秘鲁',
  count: '5.5',
  trend: 'up',
}, {
  name: '秘鲁',
  count: '5.5',
  trend: 'up',
}, {
  name: '秘鲁',
  count: '5.5',
  trend: 'up',
}, {
  name: '秘鲁',
  count: '5.5',
  trend: 'up',
},
{
  name: '秘鲁',
  count: '5.5',
  trend: 'up',
},
{
  name: '秘鲁',
  count: '5.5',
  trend: 'up',
}, {
  name: '秘鲁',
  count: '5.5',
  trend: 'up',
}, {
  name: '秘鲁',
  count: '5.5',
  trend: 'up',
}, {
  name: '秘鲁',
  count: '11',
  trend: 'up',
}]
let arrLeft: Ref<Array<object>> = ref([])
arrLeft.value = arr.value.slice(0, 5)
let arrRight: Ref<Array<object>> = ref([])
arrRight.value = arr.value.slice(6, 11)


</script>
  
<style lang="scss" scoped>
#ImportCountry {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;

  .left {
    width: 50%;
    height: 100%;
  }

  .right {
    width: 50%;
    height: 100%;
  }

  .item {
    background-color: #0A2739;
    height: 15%;
    color: #fff;
    font-size: 1rem;
    margin: 0.2rem;
    padding: 0.1rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;

    .num {
      width: 1rem;
      height: 1rem;
      margin-right: 0.3rem;
      display: inline-block;
      text-align: center;
      line-height: 1rem;
      padding: 0.1rem;
    }

    .numBg {
      border-radius: 50%;
      background-color: #C30D23;
    }

    .item_right {
      display: flex;
      align-items: center;

      .count {
        margin-left: 1rem;
        margin-right: 0.2rem;
        width: 2rem;
      }

      .trendImg {
        width: 1rem;
        height: 1rem;
        margin-top: 0.3rem;
      }
    }

    .name {
      width: 2rem;
    }

  }
}</style>